import { $http } from './index';

export function premisesAdd(data = {}) {
    return $http.post('/saas/premises/add', data);
}

export function queryPremises(data: Object) {
    return $http({ method: 'post', url: '/saas/premises/queryPremises', data });
}

export function checkPremisesName(name = '') {
    return $http.get(`/saas/premises/checkPremisesName?name=${name}`);
}

export function searchpremises(data = {}) {
    return $http.post('/saas/premises/search', data);
}

export function exportPremises(data = {}) {
    return $http({ method: 'post', url: '/saas/premises/exportPremises', data });
}

export function premisesCreate(data = {}) {
    return $http.post('/saas/premises/create', data);
}
export function premisesUpdate(data = {}) {
    return $http.post('/saas/premises/update', data);
}

export function checkPremises(data = {}) {
    return $http.get('/saas/premises/findPremise', {
        params: data,
    });
}

export function updatePremiseState(data = {}) {
    return $http.post('/saas/premises/updatePremiseState', data);
}

export function searchDraft(data = {}) {
    return $http.post('/saas//premisesDraft/query', data);
}

export function downloadTemplate(params = {}) {
    return $http.get('/saas//premisesDraft/downloadTemplate', { params });
}

export function importDraft(data = {}) {
    return $http.post('/saas/premisesDraft/import', data);
}

export function loadFiles(data = {}) {
    return $http.post('/saas/premisesDraft/loadFiles', data);
}

export function getDraftDetail(id = '') {
    return $http.get(`/saas/premisesDraft/findOne/${id}`);
}

export function draftUpdate(data = {}) {
    return $http.put('/saas/premisesDraft/update', data);
}

export function draftDelete(transferId = '') {
    return $http.delete(`/saas/premisesDraft/delete/${transferId}`);
}
export function updatePremisesContract(data = {}) {
    return $http.post('/saas/premisesContract/updatePremisesContract', data);
}
export function addPremisesContract(data = {}) {
    return $http.post('/saas/premisesContract/addPremisesContract', data);
}

export function getPremisesContract(data = {}) {
    return $http.post('/saas/premisesContract/listPremisesContract?applyOrderId=' + data.applyOrderId);
}
export function deletePremisesContract(data = {}) {
    return $http.post('/saas/premisesContract/deletePremisesContract?id=' + data.id);
}
export function downloadContractTemplate() {
    return $http.get('/saas/premisesContract/downloadTemplate');
}
export function importContractTemplate(data = {}) {
    return $http.post('/saas/premisesContract/importTemplate', data);
}
export function contractReloadRecords() {
    return $http.get('/saas/premisesContract/reloadRecords');
}
export function sureImportContract(data={}) {
    return $http.post(`/saas/premisesContract/sureImport`,data);
}
